package com.rachel.viewpagerutils;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ImageView;
import android.widget.Toast;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {

    private static final int[] RES = {R.mipmap.guide1,R.mipmap.guide2,R.mipmap.guide3};
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        CusViewPager cusViewPager = (CusViewPager) findViewById(R.id.cusviewpager);
        List<View> views = new ArrayList<>();
        for (int i = 0; i < 3; i++) {
            ImageView imageView = new ImageView(this);
            imageView.setImageResource(RES[i]);
            imageView.setScaleType(ImageView.ScaleType.FIT_XY);
            views.add(imageView);
        }

        CusPagerData cusPagerData = new CusPagerData.Builder()
                .setDataViews(views)
                .setGlideMode(true)
                .setBottomCircle(true)
                .builder();

        cusViewPager.setData(cusPagerData);
        
        cusViewPager.getBtnView().setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(MainActivity.this, "你好世界", Toast.LENGTH_SHORT).show();
            }
        });


    }
}
